#ifndef IMAGEHELPER_H
#define IMAGEHELPER_H

/*! \author Guillaume Collombet */
/*! \file This file contains several helpers function to process image images. */

#include "opencv2/opencv.hpp"

#include <functional>

using namespace cv;

/*! \addtogroup ImageHelper
 * \brief This module contains several helpers function to process images.
 *  @{
 */

template<typename T1, typename T2, int d1, int d2>
void processImage(const Mat& input, Mat& output, std::function<T2 (const Vec<T1,d1>& , int)> func);

template<typename T, int d>
void processImage(const Mat& input, Mat& output, std::function<T (const Vec<T,d>& , int)> func);

template<typename T, int d>
void processImage(const Mat& input, std::function<void (T)> func);

template <typename T>
std::pair<T,T> minmax(const Mat &input);

template <typename T, int d>
T max(const Mat& input);

template <typename T, int d>
T min(const Mat& input);

template <typename T, int d>
void extendDynamicly(const Mat& input, const Mat& output);

template <typename T, int d>
void equalizeHistogram(const Mat& input, Mat &output);

#include "imagehelper_impl.h"

/*! @} */

#endif // IMAGEHELPER_H

























//template <typename T, int dim>
//static inline T max(Vec<T,dim> vec) {
//    return max(vec,dim - 1);
//}

//template <typename T, int dim>
//static inline T max(Vec<T, dim> vec, int n) {
//    T _1 = (n > 1) ? max(vec,n - 1) : vec[n - 1];
//    T _2 = vec[n];
//    return (_1 >= _2) ? _1 : _2;
//}

//template <typename T, int dim>
//static inline T min(Vec<T,dim> vec) {
//    return min(vec,dim - 1);
//}

//template <typename T, int dim>
//static inline T min(Vec<T, dim> vec, int n) {
//    T _1 = (n > 1) ? min(vec,n - 1) : vec[n - 1];
//    T _2 = vec[n];
//    return (_1 < _2) ? _1 : _2;
//}

//template <typename T, const int d, typename Store>
//Vec<T, d> average(const Mat &input)
//{
//    Store _average;
//    processImage<T,d>(input,[&] (T val)
//    {
//        _average += val;
//    });
//    return (_average / (input.cols * input.rows);
//}

